package com.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.beans.*;
import com.DAO.*;

public class DeleteNoticeAction  extends org.apache.struts.action.Action{

	 private final static String SUCCESS = "success";
	  
	    public ActionForward execute(ActionMapping mapping, ActionForm form,
	            HttpServletRequest request, HttpServletResponse response)
	            throws Exception {
	    	int id=Integer.parseInt(request.getParameter("notice_id"));
	    	NoticeDAO noticeDao=new NoticeDAO();
	    	try
	    	{
	    	int rowsAffected=noticeDao.delete(id);
	    	
	    	}
	    	catch(Exception e)
			{
				System.out.println("Notice is is not found");
				e.printStackTrace();
			}
			
	    	noticeDao.closeConnection();
	    	return mapping.findForward(SUCCESS);
		
		} 
		
	
}
